<!DOCTYPE html>
<html>
<head>
  <title>箱子管理系统</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
  <link href="/css/bootstrap-responsive.css" rel="stylesheet" media="screen">
  <link rel="stylesheet" type="text/css" href="/css/style.css">
  <script src="/lib/jq/jquery-2.1.1.min.js"></script>
  <script src="/lib/jq/bootstrap.min.js"></script>
  <script type="text/javascript" src="/js/create.js"></script>
  <script type="text/javascript">
    var doorLayout = [
      ["一行两列", "两行一列"],
      ["两行两列", "一行四列", "四行一列"],
      ["三行两列", "两行三列"],
      ["四行两列", "两行四列"],
      ["两行五列","五行两列"],
      ["三行四列","四行三列"]
    ];

    function getNum() {
      var doorsnum = $('#first').val();
      var doorslayout = $('#secend').val();
      
      var layout=doorsnum/2-1;
      var shu=doorLayout[layout];
      var html="<option value='0'>请选择格子布局</option>";
      $.each(shu,function(key,val){
          html+="<option value='"+val+"'>"+val+"</option>";
      });
      $("#secend").html(html);
    }
  </script>
</head>
<body style="margin:15px;">
<div id="lert"></div>
    <% if (success) { %>
      <div class="alert alert-success">
          <h4><%= success %></h4>
      </div>
      <% } %>
      <% if (error) { %>
      <div class="alert alert-error">
          <h4><%= error %></h4>
      </div>
    <% } %>
  <legend>新建箱子</legend>
  <form onsubmit="return check()" style="margin-left: 25%" action="/box_management/create" method="post" name="form1" class="form-horizontal">
    <div style="margin-bottom:25px;"><span style="color:red;">*</span>项为必填项</div>
    <div class="control-group">
      <label class="control-label"><span style="color:red;">*</span>Sim卡号：</label>
      <div class="controls">
          <select name="sim" id="sim">
              <option value="0">请选择Sim卡号</option>
              <%for(var i=0;i<simdatas.length;i++){%>
              <option value="<%=simdatas[i].sim%>"><%=simdatas[i].sim%></option>
              <%}%>
          </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">购买人：</label>
      <div class="controls">
          <select name="buyer" id="buyer">
              <option value="0">请选择用户名</option>
              <%for(var i=0;i<buyerdatas.length;i++){%>
              <option value="<%=buyerdatas[i].buyer%>"><%=buyerdatas[i].buyer%></option>
              <%}%>
          </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">箱子贴条位置：</label>
      <div class="controls">
        <select name="code_layout" id="country">
          <option value="左上角">左上角</option>
          <option value="右上角">右上角</option>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label"><span style="color:red;">*</span>格子数量：</label>
      <div class="controls">
        <select name="doorNum"  onChange="getNum()" id="first">
          <option value="0">请选择格子数量</option>
          <option value="2">2</option>
          <option value="4">4</option>
          <option value="6">6</option>
          <option value="8">8</option>
            <option value="10">10</option>
            <option value="12">12</option>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label"><span style="color:red;">*</span>箱子布局：</label>
      <div class="controls">
        <select id="secend" name="boxlayout">
          <option value="0">请选择箱子布局</option>
        </select>
      </div>
    </div>
    <div class="control-group">
    <div class="controls">
    <input type="submit" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" value="提交" id="sub_btn">
  </div>
  </div>
  </form>
</body>
</html>